<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>防伪查询</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		
		<script type="text/javascript" src="js/jquery-1.8.2.min.js" ></script>
		<link rel="stylesheet" href="css/mui.min.css" />
		<link rel="stylesheet" href="css/app.css" />
	</head>
	<script>
        var htmlWidth=document.documentElement.clientWidth || document.body.clientWidth;
        var htmlDome=document.getElementsByTagName('html')[0];
            htmlDome.style.fontSize=htmlWidth/7.5+'px';
    </script>
	<style>
		*{margin: 0;padding: 0;}
		html,body{height: 100%;}
		ul li{list-style: none;}
		a{text-decoration: none;}
		img{overflow: hidden;}
		input{outline:medium;border: none;}
		.mui-btn-blue, .mui-btn-primary, input[type=submit]{background-color: #f2be6b;border-color: #f2be6b;}
		.mui-btn-danger, .mui-btn-negative, .mui-btn-red{background-color: darkgray;border-color: darkgray;}
		
		.contant{overflow: hidden; margin: auto; width: 6rem;height: 0.8rem; border-radius: 30px; background-color: #fff}
		.contant input{width: 4.5rem;height: 0.8rem;line-height: 0.8rem;color: #333333; border-radius: 30px;border: none;}
		.clickBtn{width: 1.5rem;height: 0.8rem; line-height: 0.8rem; color: #fff; font-size: 0.32rem; text-align: center; background-color:#f2be6b;border-radius: 30px;}
		
	</style>
	<body style="background: transparent url(img/bck1.jpg) no-repeat center;background-size: cover;">
		
		<!--loading-->
		<div class="loadingLayer" style="display: none;">
			<div class="layui-m-layercont">
				<i></i>
				<i></i>
				<i></i>
			</div>
		</div>
		
		<!--侧滑菜单容器-->
			<div id="Main" class="mui-off-canvas-wrap mui-draggable" style="background-color: #dddddd;">  
			
			    <!--菜单部分-->
			    <aside id="offCanvasSide" class="mui-off-canvas-left" style="width: 4rem; background-color: #ffffff;">
			        <div id="offCanvasSideScroll" class="mui-scroll-wrapper">
			        	<article class="navContant">
			        		<section class="navlist">
			        			<aside class="navImg left" style="background: transparent url(img/more.png) no-repeat center;background-size: 90%;"></aside>
			        			<aside class="navlistTitle left">更多</aside>
			        		</section>
			        		
			        		<a href="#">
				        		<section class="navlist" data-type = "3">
				        			<aside class="navImg left" style="background: transparent url(img/yuanliaoIcon.png) no-repeat center;background-size: 90%;"></aside>
				        			<aside class="navlistTitle left">原料追溯</aside>
				        		</section>
			        		</a>
			        		
			        		<a href="#">
				        		<section class="navlist" data-type = "4">
				        			<aside class="navImg left" style="background: transparent url(img/jianyanIcon.png) no-repeat center;background-size: 90%;"></aside>
				        			<aside class="navlistTitle left">检验入库</aside>
		
				        		</section>
			        		</a>
			        		<a href="#">
				        		<section class="navlist" data-type = "1">
				        			<aside class="navImg left" style="background: transparent url(img/jiagongIcon.png) no-repeat center;background-size: 90%;"></aside>
				        			<aside class="navlistTitle left">生产加工</aside>
				        		
				        		</section>
			        		</a>
			        		
			        		<a href="#">
				        		<section class="navlist" data-type = "5">
				        			<aside class="navImg left" style="background: transparent url(img/jianceIcon.png) no-repeat center;background-size: 90%;"></aside>
				        			<aside class="navlistTitle left">产品检测</aside>
			
				        		</section>
			        		</a>
			        		
			        		<a href="#">
				        		<section class="navlist" data-type = "2">
				        			<aside class="navImg left" style="background: transparent url(img/fangweiIcon.png) no-repeat center;background-size: 90%;"></aside>
				        			<aside class="navlistTitle left">防伪查询</aside>
				        		
				        		</section>
			        		</a>
			        		
			        		<a href="#">
				        		<section class="navlist" data-type = "6">
				        			<aside class="navImg left" style="background: transparent url(img/catIcon.png) no-repeat center;background-size: 90%;"></aside>
				        			<aside class="navlistTitle left">wuli饲养员</aside>
				        		
				        		</section>
			        		</a>
			        		
			        	</article>
			        	
			        	<!--千万不能删除-->
			            <button id="offCanvasHide" type="button" style="display: none;" >关闭侧滑菜单</button>
			        </div>
			    </aside>
			
			    <!-- 主界面 -->
			    <div class="mui-inner-wrap">
			        <div id="offCanvasContentScroll" class="mui-content mui-scroll-wrapper" style="background-color: #f2f2f2;">
			        <div class="mui-scroll">	
			        <!--内容模块-->
			        	<!--公用导航-->
			        	<article class="top">
			        		<section id="offCanvasShow" class="nav left" style="background: transparent url(img/more.png) no-repeat center; background-size: 90%;">
			        		</section>
			        		<!--<section class="title">防伪查询</section>-->
			        	</article>
			        	<!--公用导航-->
			        	
			        	<div style="width: 7.5rem;height: 5rem;"></div>
						<div class="contant">
							<input id="num" type="text" value="" placeholder="请输入防伪码"/>
							<div class="clickBtn right">验证</div>
						</div>
			        	
			        	
			            <!--<button id="offCanvasShow" type="button" >显示侧滑菜单</button>-->
			            
			            
			           <!--内容模块-->
			          </div>
			        </div>
			        <!-- 这个东西不能删，利用他还原界面 -->
			        <div class="mui-off-canvas-backdrop"></div>
			    </div>
			
			</div>

		<script src="js/mui.min.js"></script>
		<script type="text/javascript" src="js/app.js" ></script>
		<script>
			
			var id=getQueryVariable("id")
			function getQueryVariable(variable){
			    var query =decodeURI(window.location.search.substring(1));
			    var vars = query.split("&");
			    for (var i=0;i<vars.length;i++) {
			       var pair = vars[i].split("=");
			       if(pair[0] == variable){return pair[1];}
			    }
			    return(false);
			}
			
			
			
			$(".mui-btn-danger").on("tap",function(){
				window.history.back()
			});
			$(".clickBtn").on("tap",function(){
				var numId=$("#num").val()
				if(numId.trim()==""){
					mui.toast('请输入防伪查询码',{
						duration: 1000,
						type: 'div'
					});
					return false;
				}
				$(".loadingLayer").css("display","block");
				$.ajax({
					type: "get",
					url: 'http://39.100.115.52:8080/product/check/'+id+'/'+numId,
					data: {
						
					},
					async: true,
					dataType: 'json',
  					
					success: function(data) {
						console.log(data)
						if(data.code==200){
							setTimeout(function(){
								$(".loadingLayer").css("display","none");
								
								mui.alert('验证成功', '', function() {
									
								});
								
							},500)
							
							
						}else{
							setTimeout(function(){
								$(".loadingLayer").css("display","none");
								mui.alert('该产品可能是假冒伪劣', '验证失败', function() {
								});
							},500)
						}
					}
				});
			});
			
			$("#Main").on("tap",".navlist",function(){
				var dataType=$(this).attr("data-type");
				console.log(dataType)
				if(dataType==1){
					window.location.href="desc.html?type=1&id="+id;
					
				}
				if(dataType==2){
					window.location.href="decode.html?id="+id
				}
				if(dataType==3){
					window.location.href="desc.html?type=3&id="+id
				}
				if(dataType==4){
					window.location.href="desc.html?type=4&id="+id
				}
				if(dataType==5){
					window.location.href="desc.html?type=5&id="+id
				}
				if(dataType==6){
					window.location.href="desc.html?type=6"
				}
			});
			
		</script>
	</body>

</html>